#include "ProductTestMediaInit.h"

Com_pvoid ProductTest_IRCut_Thread(Com_pvoid arg)
{
    int i;

    for(i = 0;i < 5;i++)
    {
        Ext_SdkGpioWrite_IRCut(IRCUT_NIGHT_MODE);
        usleep(1000 * 1000);
        Ext_SdkGpioWrite_IRCut(IRCUT_DAY_MODE);
        usleep(1000 * 1000);
    }

    Ext_InComFile_Creat(DEF_FLAG_SYNC_TIME_OK);
    return NULL;
}

void Ext_ProductTest_IRCut_Switch_Init(void)
{
    pthread_t id;

    pthread_create(&id, NULL, ProductTest_IRCut_Thread,NULL);
    pthread_detach(id);
}

void Ext_ProductTest_Media_Init(pStSdkRingBufInfoProducer pro)
{
    pthread_t mic_id;
    pthread_t spk_id;
    pthread_t video_id;

#if CMAKE_ANYKA_EV300L
    sdk_run_config config;
    memset(&config,0,sizeof(config));             //init the struct
    config.mem_trace_flag = SDK_RUN_NORMAL;
    config.isp_tool_server_flag = 0;                //isp tool sever

    ak_sdk_init(&config);
#endif

    pthread_create(&mic_id,NULL,Ext_ProductTest_Mic_Thread,(void *)pro);
    pthread_create(&spk_id,NULL,Ext_ProductTest_Spk_Thread,(void *)pro);
    pthread_create(&video_id,NULL,Ext_ProductTest_Video_Thread,(void *)pro);

    pthread_detach(mic_id);
    pthread_detach(spk_id);
    pthread_detach(video_id);
}
